package jdmx.framework.service;

import java.util.ArrayList;
import java.util.Hashtable;


import jdmx.library.da.Database;
import jdmx.library.da.DatabaseFactory;
import jdmx.library.info.DbInfo;

public class DatabaseManager {
	private Hashtable<String, Database> htDatabases;	

	public void loadDatabases(ArrayList<DbInfo> dbInfos) {
		htDatabases = new Hashtable<String, Database>();
		for (DbInfo dbInfo : dbInfos) {
			Database db = DatabaseFactory.createInstance(dbInfo);
			if (db != null) htDatabases.put(dbInfo.name, db);				
		}		
	}
	
	public Database getDatabase(String key) { 
		return htDatabases.get(key);
	}
	
}
